home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / libdwarf / dwarf_frame.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.8 KB  |  135 lines

  1. /*
  2.     dwarf_frame.h
  3.  
  4.     $Revision: 1.16 $    $Date: 1994/06/17 02:39:28 $    
  5.  
  6. */
  7.  
  8. #define DW_DEBUG_FRAME_VERSION                     1
  9. #define DW_DEBUG_FRAME_AUGMENTER_STRING         "mti v1"
  10.  
  11. /* The value of the offset field for Cie's. */
  12. #define DW_CIE_OFFSET        ~(0x0)
  13.  
  14. /* The augmentation string may be NULL.    */
  15. #define DW_NULL_STRING        ""
  16.  
  17. #define DW_FRAME_INSTR_OPCODE_SHIFT        6
  18. #define DW_FRAME_INSTR_OFFSET_MASK        0x3f
  19.  
  20. /* 
  21.     This struct denotes the rule for a register in a row of
  22.     the frame table.  In other words, it is one element of 
  23.     the table.
  24. */
  25. struct Dwarf_Reg_Rule_s {
  26.  
  27.     /* 
  28.         Is a flag indicating whether the rule includes 
  29.         the offset field, ie whether the ru_offset field
  30.         is valid or not.  Actually not sure that it is
  31.         needed since the offset is always additive, and
  32.         no offset is the same as a 0 offset.
  33.  
  34.         Guess needed mostly for dwarf_get_fde_info_for_reg().
  35.     */
  36.     Dwarf_Sbyte        ru_is_off;
  37.  
  38.     /* Register involved in this rule. */
  39.     Dwarf_Half        ru_register;
  40.  
  41.     /* Offset to add to register, if indicated by ru_is_offset. */
  42.     Dwarf_Addr        ru_offset;
  43. };
  44.  
  45. typedef struct Dwarf_Frame_s    *Dwarf_Frame;
  46.  
  47. /* 
  48.     This structure represents a row of the frame table. 
  49.     Fr_loc is the pc value for this row, and Fr_reg
  50.     contains the rule for each column.
  51. */
  52. struct Dwarf_Frame_s {
  53.  
  54.     /* Pc value corresponding to this row of the frame table. */
  55.     Dwarf_Addr            fr_loc;
  56.  
  57.     /* Rules for all the registers in this row. */
  58.     struct Dwarf_Reg_Rule_s    fr_reg[DW_FRAME_LAST_REG_NUM];
  59.  
  60.     Dwarf_Frame            fr_next;
  61. };
  62.  
  63. typedef struct Dwarf_Frame_Op_List_s    *Dwarf_Frame_Op_List;
  64.  
  65. /* This is used to chain together Dwarf_Frame_Op structures. */
  66. struct Dwarf_Frame_Op_List_s {
  67.     Dwarf_Frame_Op            *fl_frame_instr;
  68.     Dwarf_Frame_Op_List        fl_next;
  69. };
  70.  
  71. /* 
  72.     This structure contains all the pertinent info for a Cie. Most 
  73.     of the fields are taken straight from the definition of a Cie.  
  74.     Ci_cie_start points to the address (in .debug_frame) where this 
  75.     Cie begins.  Ci_cie_instr_start points to the first byte of the 
  76.     frame instructions for this Cie.  Ci_dbg points to the associated 
  77.     Dwarf_Debug structure.  Ci_initial_table is a pointer to the table 
  78.     row generated by the instructions for this Cie.
  79. */
  80. struct Dwarf_Cie_s {
  81.     Dwarf_Word            ci_length;
  82.     char                   *ci_augmentation;
  83.     Dwarf_Small            ci_code_alignment_factor;
  84.     Dwarf_Sbyte            ci_data_alignment_factor;
  85.     Dwarf_Small            ci_return_address_register;
  86.     Dwarf_Small            *ci_cie_start;
  87.     Dwarf_Small            *ci_cie_instr_start;
  88.     Dwarf_Debug            ci_dbg;
  89.     Dwarf_Frame            ci_initial_table;
  90.     Dwarf_Cie            ci_next;
  91. };
  92.  
  93. /*
  94.     This structure contains all the pertinent info for a Fde.
  95.     Most of the fields are taken straight from the definition.
  96.     fd_cie_index is the index of the Cie associated with this
  97.     Fde in the list of Cie's for this debug_frame.  Fd_cie
  98.     points to the corresponsing Dwarf_Cie structure.  Fd_fde_start
  99.     points to the start address of the Fde.  Fd_fde_instr_start
  100.     points to the start of the instructions for this Fde.  Fd_dbg
  101.     points to the associated Dwarf_Debug structure.
  102. */
  103. struct Dwarf_Fde_s {
  104.     Dwarf_Word      fd_length;
  105.     Dwarf_Addr    fd_cie_offset;
  106.     Dwarf_Sword    fd_cie_index;
  107.     Dwarf_Cie    fd_cie;
  108.     Dwarf_Addr    fd_initial_location;
  109.     Dwarf_Small    *fd_initial_loc_pos;
  110.     Dwarf_Addr    fd_address_range;
  111.     Dwarf_Small    *fd_fde_start;
  112.     Dwarf_Small    *fd_fde_instr_start;
  113.     Dwarf_Debug    fd_dbg;
  114.     Dwarf_Fde    fd_next;
  115. };
  116.  
  117.  
  118. /* These error codes are very specific to debug_frame
  119.    but they should probably be moved into dwarf_error.h
  120. */
  121. #define DF_NO_CIE_AUGMENTATION        -1
  122. #define DF_REG_NUM_TOO_HIGH        -2
  123. #define DF_MAKE_INSTR_NO_INIT        -3
  124. #define DF_NEW_LOC_LESS_OLD_LOC        -4
  125. #define DF_POP_EMPTY_STACK        -5
  126. #define DF_ALLOC_FAIL            -6
  127. #define DF_FRAME_DECODING_ERROR        -7
  128.  
  129.  
  130. int
  131. _dwarf_frame_address_offsets(Dwarf_Debug dbg,Dwarf_Addr  **addrlist,
  132.         Dwarf_Off  **offsetlist,Dwarf_Signed *returncount,
  133.     Dwarf_Error *err);
  134.  
  135.